/***
 * @file BoolExp.cpp
 *
 *  @Author: calle
 *  @date May 1, 2011
 *  
 *  @brief
 *  	
 */

#include "BoolExp.h"
#include <RandomPkg/Randomizer.h>



BoolExp::BoolExp(bool b):m_bool(b) {


}

BoolExp::~BoolExp() {

}

bool BoolExp::getBool() const
{
    return m_bool;
}

void BoolExp::setBool(bool m_bool)
{
    this->m_bool = m_bool;
}

IExp *BoolExp::clone() const
{
	return new BoolExp(m_bool);
}



void BoolExp::accept(IExpVisitor *v)
{
	v->VisitBoolExp(this);
}

AbsSyn::IExpPtr BoolExp::generateBoolExp()
{
	RandomPkg::Randomizer rndGen;
	bool rndBool = (rndGen.createRandom(0,1) == 1 ? true : false);
	 AbsSyn::IExpPtr boolExp(new BoolExp(rndBool));
	 return boolExp;
}

bool BoolExp::operator==( const BoolExp& rhs)
{
	bool ret = false;
	if( getBool() == rhs.getBool() )
	{
		ret = true;
	}

	return ret;

}

bool BoolExp::operator!=( const BoolExp& rhs)
{
	return !((*this) == rhs);
}

std::string BoolExp::toString() const
{
	return (m_bool ? "True":"False");
}

